<template>
	<view class="g-h5 body-content">
		<u-navbar back-text="返回" title="所有笔记"></u-navbar>
		<view class="search-view">
			<u-search placeholder="快速查找" :show-action="false" bg-color="#DFE0E4"></u-search>
		</view>
		<view class="label-content-view">
			<view class="user-menu-list">
				<view class="user-menu-list-top">
					<view class="user-menu-list-text">最近新建的笔记</view>
					<view @tap.stop="addNote"><u-icon name="plus-circle" size="34" color="#999"></u-icon></view>
				</view>
				<view class="remark-content-view" v-for="(item,index) in collectList" :key="index"
					@tap.stop="goNote(item)">
					<view class="remark-list-top">
						<view class="remark-text-view">
							<view class="remark-title">{{item.content}}</view>
							<view class="remark-text">{{item.tips ? item.tips : '暂无标注'}}</view>
						</view>
						<image class="remark-image" :src="item.image" mode=""></image>
					</view>
					<view class="remark-book-bottom">
						<view class="remark-import-text">
							{{item.time ? item.time : '1585926095536' | timeFrom('yyyy-mm-dd hh:MM:ss')}}
						</view>
						<view><u-icon name="coupon-fill" size="38"></u-icon></view>
					</view>
				</view>
			</view>

		</view>
		<u-tabbar v-model="tabCurrent" :list="tabList"></u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				collectList: [],
				tabList: [{
						iconPath: 'home',
						selectedIconPath: 'home-fill',
						text: '在读',
						customIcon: false,
						pagePath: '/pages/miniprogram/index'
			 		 					},
					{
						iconPath: 'photo',
						selectedIconPath: 'photo-fill',
						text: '书架',
						customIcon: false,
						pagePath: '/pages/miniprogram/books'
			 		 					},
					{
						iconPath: 'https://cdn.uviewui.com/uview/common/min_button.png',
						selectedIconPath: 'https://cdn.uviewui.com/uview/common/min_button_select.png',
						text: '书店',
						customIcon: false,
						pagePath: '/pages/miniprogram/bookshop'
			 		 					},
					{
						iconPath: 'play-right',
						selectedIconPath: 'play-right-fill',
						text: '我的',
						customIcon: false,
						pagePath: '/pages/miniprogram/user'
			 		 					},
			 		 				],
				tabCurrent: 0,
			}
		},
		onLoad() {
			this.collectList = this.$api.note_list()
		},
		methods: {
			goNote(item) {
				console.log(item, 444)
				uni.navigateTo({ url: '/pages/miniprogram/addnote?data=' + JSON.stringify(item) + '&type=1' })
			},
			addNote() {
				let item = {
					name: '理想国（汉译世界学术名著丛书）',
					image: 'https://wfqqreader-1252317822.image.myqcloud.com/cover/243/33889243/t6_33889243.jpg',
					content: '',
					tips: '',
					status: 1,
					time: '',
					label: []
				}
				uni.navigateTo({ url: '/pages/miniprogram/addnote?data=' + JSON.stringify(item) + '&type=2' })
			}
		}
	}
</script>

<style scoped>
	.search-view {
		padding: 30rpx 40rpx;
	}

	.label-content-view {
		padding: 0 40rpx;
	}

	.label-list {
		padding: 20rpx;
		background-color: #fff;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-radius: 20rpx;
	}

	.label-list-view {
		padding: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #999999;
	}

	.label-list-view:last-child {
		border-bottom: none;
	}

	.label-left-view {
		display: flex;
		align-items: center;
		font-size: 28rpx;
	}

	.label-right-view {
		display: flex;
		align-items: center;
		font-size: 24rpx;
		color: #999;
	}

	.user-menu-list {
		margin-top: 20rpx;
	}

	.user-menu-list-top {
		display: flex;
		color: #999;
		font-size: 24rpx;
		margin-bottom: 20rpx;
		align-items: center;
		justify-content: space-between;
	}

	.user-menu-content {
		padding: 20rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		margin-top: 20rpx;
	}

	.menu-content-list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx;
		border-bottom: 1rpx solid #ECEDF1;
	}

	.menu-left-view {
		display: flex;
		align-items: center;
	}

	.remark-content-view {
		border-radius: 20rpx;
		background-color: #ffffff;
		padding: 20rpx 30rpx;
		margin-bottom: 20rpx;
	}

	.remark-list-top {
		display: flex;
		justify-content: space-between;
	}

	.remark-title {
		font-size: 30rpx;
		width: 480rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.remark-text {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
		width: 480rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.remark-image {
		width: 120rpx;
		height: 120rpx;
	}

	.remark-book-bottom {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.remark-import-text {
		padding: 4rpx 12rpx;
		background-color: #F7E598;
		font-size: 24rpx;
		border-radius: 6rpx;
	}
</style>